package com.mju.dao;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.mju.pojo.Product;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;

@Mapper
public interface ProductDao extends BaseMapper<Product> {
    /**
     * 查询商品前四条数据
     * @return
     */
    @Select("SELECT * FROM t_product WHERE status=1 ORDER BY priority DESC LIMIT 0,4")
    List<Product> selectHotList();



    /**
     * 根据指定的名称按关键字进行模糊查询
     * @param title
     * @return
     */
    @Select("SELECT id,title,sell_point,price,image" +
            "    FROM t_product" +
            "    WHERE STATUS = 1" +
            "    AND title LIKE '%${title}%'" +
            "    ORDER BY priority DESC;")
    List<Product> queryProductByTitle(String title);
}
